<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Administrator Page</title>
</head>
<%
	try {
		if (!(request.getSession().getAttribute("userId")
				.equals("admin")))
			response.sendRedirect("AccessDenied.jsp");
	} catch (Exception e) {
		response.sendRedirect("AccessDenied.jsp");
	}
%>
<body style="background-color: #94C0D6">
	<img alt="" src="Swim.jpg" style="height: 64px; width: 200px;">
	<form
		style="background-color: #A6B0DB; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin; border-top-color: #8080FF; border-right-color: #8080FF; border-top-style: solid; border-right-style: solid; height: 24px;">
		<a href="LogOutServlet">Logout</a>
	</form>
<center>
	<form action="AbilityAddingServlet" style="background-color: #8080C0; width: 382px; height: 274px">
		<center>
			<center>
				<br><b>PENDING ABILITIES</b><br><br>
			</center>
	</center>
		<center>
			<%@page import="java.util.*"%>
			<%@page import="entities.AskForAdding,entities.AskForAddingPK"%>
			<select name="ability" id="Select1"
				size="
    <%ArrayList<AskForAdding> abilityList = (ArrayList<AskForAdding>) request.getSession().getAttribute("abilities");
			if (abilityList != null) {
				int length = abilityList.size();
				out.print(length);
			} else {
				out.print(0);
			}%>"
				multiple="multiple" style="height: 61px; width: 230px">
				<%
					int i = 0;
					if (abilityList != null) {
						for (AskForAdding ability : abilityList) {
							out.println("<option name = \"value\" value=\""
									+ ability.getKey().getAbilityName() + "\">" + ability.getKey().getUser().getUserId() + 
									" asks for " + ability.getKey().getAbilityName() + "</option>");
							i++;
						}
					}
				%>
			</select>
		</center>
	<center>
		
			<center>
				<br><b>ADDING NEW ABILITIES</b><br><br>
			</center>
	</center>
		<center>
			<input name="ability"><input type="submit" value="Add">
		</center>
		<center>
			<%
			String status = (String) request.getSession().getAttribute("status");
				out.println(status == null ? "" : status);
			%>
		</center>
	</form>
	</center>
</body>
</html>